home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / surfsrc3.zip / PERFORM.INC < prev    next >
Text File  |  1991-09-28  |  2KB  |  55 lines

  1. { PERFORM.INC: Procedures to implement the performance window }
  2. { Variables shared between functions in this file: }
  3. var   Plottime: real;                      { time to complete last plot }
  4.       Plot_nsurf: word;                    { # surfaces plotted last }
  5.       Plotstart: real;                     { time when plot started }
  6.  
  7. procedure PERF_START;
  8. var hr, min, sec, sec100: word;
  9.  
  10. begin
  11.   gettime (hr, min, sec, sec100);
  12.   Plotstart := 3600.0*hr + 60.0*min + sec + 0.01*sec100;
  13. end; { PERF_START }
  14.  
  15. procedure PERF_STOP (Plottype: integer);
  16. var hr, min, sec, sec100: word;
  17.     Plotstop: real;
  18.  
  19. begin
  20.   Lastplot := Plottype;
  21.   if (Lastplot > 0) then begin
  22.     Plot_nsurf := Nsurf;
  23.     gettime (hr, min, sec, sec100);
  24.     Plotstop := 3600.0*hr + 60.0*min + sec + 0.01*sec100;
  25.     if (Plotstop < Plotstart) then
  26.       { Assume we just crossed a day boundary.
  27.         Hey, we might have crossed two days, but let's hope SURFMODL
  28.         never gets THAT slow!
  29.       }
  30.       Plottime := Plotstop + 24.0 - Plotstart
  31.     else
  32.       Plottime := Plotstop - Plotstart;
  33.   end;
  34. end; { PERF_STOP }
  35.  
  36. procedure PERF_SHOW;
  37. var Surf_per_sec: real;
  38.  
  39. begin
  40.   { Clear the screen }
  41.   window (1,1,80,25);       { use full screen }
  42.   clrscr;
  43.   if (Lastplot > 0) then begin
  44.     { Print performance statistics at bottom of screen. }
  45.     window (13,24,80,25);
  46.     gotoXY(1,1);
  47.     write ('PERFORMANCE: ', Plot_nsurf);
  48.     if (Lastplot = 5) then
  49.       write (' Gouraud-Shaded');
  50.     writeln (' Surfaces in ', Plottime:4:1, ' Seconds');
  51.     Surf_per_sec := Plot_nsurf / Plottime;
  52.     write ('             (', Surf_per_sec:4:1, ' Surfaces/Second)');
  53.   end;
  54. end; { PERF_SHOW }
  55.